<?
//检查是否有权限
//include_once("../../../common/modules/checkA.php");

//获取根目录的系统设置文件
include_once("../../../config.php");
include_once("../../controller/detail-statistic.php");
$seo['description'] = "";
$seo['keyword']     = "";
$seo['title']       = "天宫信息科技";





$data['title']="任务详情";

//查询任务板块管理员
$setting = select_one_line_all_items($table_Prefix."task_setting","nid = '1'");
$manager_user_id = explode(',',$setting['manager_user_id']);


// 权限验证 管理员查看所有人的任务 普通用户只查看自己的任务
if(in_array($_SESSION['nid'],$manager_user_id)){
    $auth = true;
}else{
    $auth = false;
}

//获取任务信息
$task=select_one_line_all_items($table_Prefix."task","nid = '".$_REQUEST['nid']."'");



//获取任务留言

$task_comment=select_lines_all_items($table_Prefix."task_comment", "nid asc", "task_id = '".$_REQUEST['nid']."' ","");
$data['employee']=select_lines_all_items($table_Prefix."employee","nid asc","status = '在职'","");


//同时写入你的阅读记录
if($task_comment['notice_member_read'])
{
    $_read_log=$task_comment['notice_member_read'].",";
}
else
{
    $_read_log="";
}

$_member_read['ai_notice_member_read']=$_read_log.$_SESSION['nid'];


$_read_sql=update_date($table_Prefix."task_comment",$_member_read,"task_id",$_REQUEST['task_nid']);

$query = mysql_query($_read_sql) or die ($_read_sql);
mysql_close($con);

//设置默认的任务结束时间


//获取本周周一的日期
// 获取当前时间的时间戳
$current_time = time();

// 计算本周一的Unix时间戳（偏移量是当前星期几减去1）
$weekday = date('N', $current_time) - 1;
if ($weekday == 0) {
    // 如果今天是周一，则不需要偏移
    $start_of_week = $current_time;
} else {
    // 否则，计算周一的时间戳
    $start_of_week = strtotime("-{$weekday} days", $current_time);
}

// 格式化本周一的日期为'Y-m-d'
$start_date = date('Y-m-d', $start_of_week);




// 计算本周日的Unix时间戳（偏移量是7减去当前星期几）
$weekday = date('N', $current_time);
if ($weekday == 7) {
    // 如果今天是周日，则不需要偏移
    $end_of_week = $current_time;
} else {
    // 否则，计算周日的时间戳
    $end_of_week = strtotime("next Sunday", $current_time);
}

// 格式化本周日的日期为'Y-m-d'
$end_date = date('Y-m-d', $end_of_week);





if($_REQUEST['select_startday'])
{
    $start_date=$_REQUEST['select_startday'];
}


if($_REQUEST['select_endday'])
{
    $end_date=$_REQUEST['select_endday'];
}


$principal_list=select_lines_all_items($table_Prefix."employee","nid desc","","0");
$member_name_list=transform_2darray_in_1darray_with_new_key($principal_list,"nid",'name');
$principal=select_one_line_all_items($table_Prefix."employee","nid = '".$detail['principal']."'");

$case_list=select_lines_all_items($table_Prefix."case","nid desc","","0");
$case=select_one_line_all_items($table_Prefix."case","nid = '".$task['case_id']."'");
?>
